#ifndef  TEXTURELIST_HPP
# define TEXTURELIST_HPP

# include <SFML/Graphics.hpp>
# include <vector>
# include <string>
# include "datatree.hpp"
# include "ressourceslist.hpp"

namespace Shiny
{
  typedef RessourceList<sf::Texture> TextureList;

  class AnimationList
  {
  public:
    class Animation
    {
      friend class SpriteAnimate; // SpriteAnimate can be based on AnimationList::Animation
    public:
      Animation(const std::string& name, Data data, TextureList& tex);
      
      bool              operator==(const std::string&) const;

    private:
      void LoadRect(Data data);

      std::string        _name;
      const sf::Texture* _tex;
      unsigned short     _nFrames;
      bool               _inLoop;
      float              _refreshRate;
      sf::IntRect        _rect;
    };

    AnimationList(Data, TextureList&);
    AnimationList(void) {}

    const Animation*       operator[](const std::string&) const;

  private:
    std::vector<Animation> _anims;
  };
}

#endif
